package hushi.controller;

import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * 在jsp文件里面要释放EL表达式，（isELIgnored="false），否则传不了数据
 */
@org.springframework.stereotype.Controller
public class Controller {
    @GetMapping("servlerapi")
    public String doSA(HttpServletRequest request){
        request.setAttribute("name:","SuXJ");
        request.setAttribute("xm","SuXueJing");
        return "test.jsp";
    }
    @GetMapping("modelandview")
    public ModelAndView doMAV(){
        ModelAndView mav = new ModelAndView("test.jsp");
        mav.addObject("name","SuXJ");
        return mav;
    }
    @GetMapping("model")
    public String doModel(Model model){
        model.addAttribute("name","SuXJ");
        return "test.jsp";
    }
}
